package com.hmall.api.item;

import com.hmall.api.item.dto.ItemDTO;
import com.hmall.api.item.dto.OrderDetailDTO;
import com.hmall.common.utils.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;


/**
 * 商品服务的远程调用
 */
@FeignClient(name = "item-service", path = "/items",fallbackFactory = ItemClientFallbackFactory.class)
public interface ItemClient {
    @GetMapping
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

    @PutMapping("/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);

    @GetMapping("{id}")
    ItemDTO queryItemById(@PathVariable("id") Long id);

 /*   @PostMapping
    void saveItem(@RequestBody ItemDTO item);

    @DeleteMapping("{id}")
    void deleteItemById(@PathVariable("id") Long id);*/
}
